home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Power.h
-
- Contains: Power Manager Interfaces.
-
- Version: System 7.5
-
- DRI: Mike Hanlon
-
- Copyright: © 1984-1996 by Apple Computer, Inc.
- All rights reserved.
-
- Warning: *** APPLE INTERNAL USE ONLY ***
- This file may contain unreleased API's
-
- BuildInfo: Built by: Dave Falkenburg
- With Interfacer: 2.0d13 (PowerPC native)
- From: Power.i
- Revision: 45
- Dated: 10/8/96
- Last change by: CSS
- Last comment: Add pmChargeStatusChanged and hasChargeNotification for
-
- Bugs: Report bugs to Radar component “System Interfaces”, “Latest”
- List the version information (from above) in the Problem Description.
-
- */
- #ifndef __POWER__
- #define __POWER__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
- #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
- #ifndef __MIXEDMODE__
- #include <MixedMode.h>
- #endif
- #endif
- #if FOR_SYSTEM8_PREEMPTIVE
- #ifndef __KERNEL__
- #include <Kernel.h>
- #endif
- #ifndef __NAMEREGISTRY__
- #include <NameRegistry.h>
- #endif
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- #if FOR_SYSTEM8_PREEMPTIVE
- /*
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
- Low level (I/O architecture) interface
-
- */
- /*••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- /*
- //------------------------------------------------------------------------------------
-
- Power Management usage monitoring.
-
- High level families call PMMonitorActivity for each hardware device they maintain.
- Power management will periodically send messages to the family requesting the
- current PMActivityInfo for each device.
- If power management determines that a device is idle it may be taken off-line.
- Prior to doing so power managment will send a message instructing the family to
- prepare for the device being off-line. When the device is reqired again the family
- uses PMMakeDeviceAvailable[Async] to instruct power management to bring the device
- back on-line.
-
- */
- /*------------------------------------------------------------------------------------*/
- struct PMActivityInfo {
- OptionBits flags;
- UInt32 requestCount;
- };
- typedef struct PMActivityInfo PMActivityInfo;
-
- typedef struct OpaquePMMonitorRef* PMMonitorRef;
- extern OSStatus PMMonitorActivity(RegEntryRef *deviceToBeMonitored, ObjectID adminMessageObject, void *refCon, PMMonitorRef *newRef);
-
- extern OSStatus PMStopMonitoring(PMMonitorRef ref);
-
- /*
- //------------------------------------------------------------------------------------
-
- Device Power State Management
-
- If a family maintains a device which is capable of switching between multiple
- power states, the family should inform power management of the device's
- capabilities and wait for messages directing it to change the device's power
- state.
-
- */
- /*------------------------------------------------------------------------------------*/
-
- enum {
- kPMDeviceStateVersion = 1
- };
-
- typedef OSType PMDeviceStateID;
- typedef UInt32 PMDeviceStateFlags;
-
- enum {
- kPMDevicePoweredMask = 0x0001, /* device powered vs. not */
- kPMDeviceConfiguredMask = 0x0002, /* internal configuration retained vs. not */
- kPMDeviceUsableMask = 0x0004, /* "on-line" vs "off-line" (usable or not) */
- kPMDevicePowerLowestMask = 0x0100, /* set for device's highest state */
- kPMDevicePowerHighestMask = 0x0200 /* set for device's lowest state */
- };
-
- struct PMDeviceState {
- PMDeviceStateID id; /* state identifier - not interpreted by power management */
- UInt32 relativeConsumption; /* relative ranking of power consumption */
- PMDeviceStateFlags flags; /* one or more of the bits defined above */
- };
- typedef struct PMDeviceState PMDeviceState;
-
- extern OSStatus PMManageDeviceState(RegEntryRef *deviceToBeManaged, ObjectID adminMessageObject, PBVersion deviceStateVersion, PMDeviceState *deviceStates, ItemCount numberOfStates, void *refCon);
-
- extern OSStatus PMStopManagingDevice(RegEntryRef *deviceToStopManaging);
-
- /*
- //------------------------------------------------------------------------------------
-
- Domain Power Level Management
-
- */
- /*------------------------------------------------------------------------------------*/
-
- enum {
- kPMDomainLevelVersion = 1
- };
-
- typedef UInt32 PMDomainID;
- typedef UInt32 PMDomainLevel;
-
- enum {
- kPMDomainOff = 0,
- kPMDomainFreeze = 1,
- kPMDomainReduced = 2,
- kPMDomainFull = 3,
- kPMDomainReset = 4 /* Reset of the root domain is system restart */
- };
-
- extern OSStatus PMManageDomainLevel(PMDomainID domainToBeManaged, ObjectID adminMessageObject, PBVersion domainLevelVersion, PMDomainLevel *domainLevels, ItemCount numberOfLevels, void *refCon);
-
- extern OSStatus PMStopManagingDomain(PMDomainID domainToStopManaging);
-
- /*
- //------------------------------------------------------------------------------------
-
- Power Management notification.
-
- Any entity in the I/O architecture can use these routines to be notified about
- changes to device.
-
- Clients use a mask to specify which device aspects they are interested in and
- also to specify when to be notified. Flags describing the new state are generated
- and delivered with the notification.
-
- If the client is interested in power being removed and re-applied, they can request
- it with (kPMNotifyAlwaysMask | kPMNotifyPowerMask). When the notification is
- delivered the client can check the new flags against kPMNotifyBeforeMask and
- kPMNotifyAfterMask to determine if the change has already occured or not. And can
- check against kPMDevicePoweredMask to determine if the device will have power or
- not in the new state.
-
- */
- /*------------------------------------------------------------------------------------*/
- typedef UInt32 PMNotifyFlags;
-
- enum {
- kPMNotifyPowerMask = 0x00000001,
- kPMNotifyConfigurationMask = 0x00000002,
- kPMNotifyUsabilityMask = 0x00000004,
- kPMNotifyAllMask = 0x00000007,
- kPMNotifyBeforeMask = 0x40000000, /* notification sent before change */
- kPMNotifyAfterMask = 0x80000000, /* notification sent after change */
- kPMNotifyAlwaysMask = 0xC0000000 /* notification sent before and after */
- };
-
- typedef struct OpaquePMNotifyRef* PMNotifyRef;
- extern OSStatus PMNotifyStateChange(RegEntryRef *interestingDevice, ObjectID adminMessageObject, PMNotifyFlags notifyFlags, void *refCon, PMNotifyRef *newRef);
-
- extern OSStatus PMStopNotification(PMNotifyRef ref);
-
- /*
- //------------------------------------------------------------------------------------
-
- Power Management message
-
- This structure is used for all types of power management communication - usage
- monitoring, state change notification, and state change commands.
-
- */
- /*------------------------------------------------------------------------------------*/
-
- enum {
- kPMRetrieveActivityMessage = 1,
- kPMGetDeviceStateMessage = 2,
- kPMSetDeviceStateMessage = 3,
- kPMGetDomainLevelMessage = 4,
- kPMSetDomainLevelMessage = 5,
- kPMNotifyStateChangeMessage = 6
- };
-
- union PMMessageData {
- PMDeviceStateID targetState; /* used in kPMSetDeviceStateMessage */
- PMDomainLevel targetLevel; /* used in kPMSetDomainLevelMessage */
- PMNotifyFlags newStateFlags; /* used in kPMNotifyStateChangeMessage */
- };
- typedef union PMMessageData PMMessageData;
-
- struct PMMessage {
- UInt32 ampReserved; /* reserved for use by AdminMessagePort service */
- UInt32 messageCode; /* one of the message codes above */
- void * refCon; /* refCon passed to power management */
- PMMessageData data; /* message-specific extra data (see above) */
- };
- typedef struct PMMessage PMMessage;
-
- /*
- //------------------------------------------------------------------------------------
-
- Restoring an off-line or powered off device to a usable state.
-
- When a device that has been taken off-line or has had its power removed is needed
- again, the following routine should be called. This routine will return when after
- the device has been restored (or has failed to be restored). Part of the restoration
- process is delivering notifications to interested parties - kPMPowerRestore and/or
- kPMPrepareOnLine messages will be delivered and processed before this routine
- returns.
-
- */
- /*------------------------------------------------------------------------------------*/
- extern OSStatus PMMakeDeviceAvailable(RegEntryRef *whichDevice);
-
- extern OSStatus PMMakeDeviceAvailableAsync(RegEntryRef *whichDevice, KernelNotification *howToNotify);
-
- extern OSStatus PMMakeDomainAvailable(PMDomainID whichDomain);
-
- extern OSStatus PMMakeDomainAvailableAsync(PMDomainID whichDomain, KernelNotification *howToNotify);
-
- /*
- //------------------------------------------------------------------------------------
-
- Disabling & Re-Enabling power managment of a device.
-
- Power management of a specific device can be disabled - this may be desirable
- because of a resource reservation on some device.
- Families can implement a family specific API on top of this that can allow
- an application to turn off power management for a particular volume or display
- device.
-
- When power management of some device is disabled usage monitoring will still
- occur, but there will not be any requests to change the device state. The
- domain of which the device is a member will not be changed either.
-
- */
- /*------------------------------------------------------------------------------------*/
- extern OSStatus PMDisablePowerManagement(RegEntryRef *whichDevice);
-
- extern OSStatus PMEnablePowerManagement(RegEntryRef *whichDevice);
-
- /*
- //------------------------------------------------------------------------------------
-
- Useful Name Registry names and constants.
-
- */
- /*------------------------------------------------------------------------------------*/
-
- #define kPowerDomainTree "power-domain-tree"
-
- /*
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
- High level (application) interface.
-
- */
- /*••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- /*
- Disk timer: the time a disk must be idle before it is spun down (or other
- power management actions are taken). Applies to all disks, but each disk
- has its own timer (one can stay spun up while the others are spun down).
-
- The minimum will be enforced.
-
- These API control system-wide parameters for the power management of disk devices.
- For control over a specific disk see the <Block Storage or File System> API.
-
-
- */
-
- enum {
- kPMDiskSpinDownDisabled = 0
- };
-
- extern OSStatus PMSetDiskSpinDownTimeout(UInt32 seconds);
-
- extern UInt32 PMGetDiskSpinDownTimeout(void );
-
- extern UInt32 PMGetMinimumDiskSpinDownTimeout(void );
-
- /*
- Display timer: the period of time in which there has been no user input
- before a display is dimmed or turned off. Applies to all displays, but
- each display has its own timer.
-
- The minimum will be enforced.
- */
-
- enum {
- kPMDisplayDimmingDisabled = 0
- };
-
- extern OSStatus PMSetDisplayDimmingTimeout(UInt32 seconds);
-
- extern UInt32 PMGetDisplayDimmingTimeout(void );
-
- extern UInt32 PMGetMinimumDisplayDimmingTimeout(void );
-
- /*
- Idle state timer: the period of time in which all devices must be idle
- before the system is [?]. Basically, this is the timer for whatever action
- the user chose to happen when the system is idle. Could be sleep, hibernate,
- or shutdown. If the user has explicitly disabled any action the routines
- return an error.
-
- The minimum will be enforced and will be greater than or equal to the
- maximum of disk spin down and display dimming times.
- */
-
- enum {
- kPMIdleStateDisabled = 0
- };
-
- extern OSStatus PMSetIdleStateTimeout(UInt32 seconds);
-
- extern UInt32 PMGetIdleStateTimeout(void );
-
- extern UInt32 PMGetMinimumIdleStateTimeout(void );
-
- /*
- Idle state: routines to get and set the action to be taken when power
- management has determined that the system is idle.
- Disabled: nothing happens when the machine is idle
- Sleep is a soft definition - depends on the hardware: differs
- between portable and desktop systems.
- Hibernate: save everthing and shutdown, on boot reload the saved
- state.
- Shutdown: just shutdown, nothing restored on boot.
- */
-
- enum {
- kPMIdleStateKindShutdown = 1,
- kPMIdleStateKindHibernate = 2,
- kPMIdleStateKindSleep = 3
- };
-
- extern OSStatus PMSetIdleStateKind(UInt32 idleStateKind);
-
- extern UInt32 PMGetIdleStateKind(void );
-
- /*
- Misc. timers: These allow for programmable shutdown and power on. These are
- real absolute times - turn off at 6:00pm Jan 12 and back on at 8:00am Feb 1.
- The 'DateAndTimeSpec' is a made-up placeholder.
-
- Shutdown is a real shutdown.
- IdleAction puts the machine into the chosen idle state - if the machine is
- shutdown at the that time nothing happens.
- PowerOn is either a normal boot or a return-from-idle depending on whether
- the system is shutdown or is in its idle state.
- */
- #define kPMClearTime (ConstTimeObjectPtr) NULL
- extern OSStatus PMSetShutdownTime(ConstTimeObjectPtr when);
-
- extern OSStatus PMGetShutdownTime(TimeObjectPtr when);
-
- extern OSStatus PMSetIdleStateTime(ConstTimeObjectPtr when);
-
- extern OSStatus PMGetIdleStateTime(TimeObjectPtr when);
-
- extern OSStatus PMSetPowerOnTime(ConstTimeObjectPtr when);
-
- extern OSStatus PMGetPowerOnTime(TimeObjectPtr when);
-
- /* Immediate control over system mode*/
- extern OSStatus PMRestart(void );
-
- extern OSStatus PMShutdown(void );
-
- extern OSStatus PMHibernate(void );
-
- extern OSStatus PMSleep(void );
-
- /*
- //------------------------------------------------------------------------------------
-
- Other high level API.
-
- Other families may want to implement their own power management API that is built
- on top of the API presented here. Examples are the ability to turn off power
- management of a specific storage volume or a specific graphics display. The battery
- family will want/need to export a high level API that can show battery state.
-
- */
- /*------------------------------------------------------------------------------------*/
- #endif
- #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
-
- enum {
- /* Bit positions for ModemByte */
- modemOnBit = 0,
- ringWakeUpBit = 2,
- modemInstalledBit = 3,
- ringDetectBit = 4,
- modemOnHookBit = 5, /* masks for ModemByte */
- modemOnMask = 0x01,
- ringWakeUpMask = 0x04,
- modemInstalledMask = 0x08,
- ringDetectMask = 0x10,
- modemOnHookMask = 0x20, /* bit positions for BatteryByte */
- chargerConnBit = 0,
- hiChargeBit = 1,
- chargeOverFlowBit = 2,
- batteryDeadBit = 3,
- batteryLowBit = 4,
- connChangedBit = 5, /* masks for BatteryByte */
- chargerConnMask = 0x01,
- hiChargeMask = 0x02,
- chargeOverFlowMask = 0x04,
- batteryDeadMask = 0x08,
- batteryLowMask = 0x10,
- connChangedMask = 0x20, /* bit positions for SoundMixerByte */
- MediaBaySndEnBit = 0,
- PCISndEnBit = 1,
- ZVSndEnBit = 2,
- PCCardSndEnBit = 3, /* masks for SoundMixerByte */
- MediaBaySndEnMask = 0x01,
- PCISndEnMask = 0x02,
- ZVSndEnMask = 0x04,
- PCCardSndEnMask = 0x08
- };
-
-
- enum {
- /* commands to SleepQRec sleepQProc */
- sleepRequest = 1,
- sleepDemand = 2,
- sleepWakeUp = 3,
- sleepRevoke = 4,
- sleepUnlock = 4,
- sleepDeny = 5,
- sleepNow = 6,
- dozeDemand = 7,
- dozeWakeUp = 8,
- dozeRequest = 9, /* SleepQRec.sleepQFlags */
- noCalls = 1,
- noRequest = 2,
- slpQType = 16,
- sleepQType = 16
- };
-
- /* bits in bitfield returned by PMFeatures */
-
- enum {
- hasWakeupTimer = 0, /* 1=wakeup timer is supported */
- hasSharedModemPort = 1, /* 1=modem port shared by SCC and internal modem */
- hasProcessorCycling = 2, /* 1=processor cycling is supported */
- mustProcessorCycle = 3, /* 1=processor cycling should not be turned off */
- hasReducedSpeed = 4, /* 1=processor can be started up at reduced speed */
- dynamicSpeedChange = 5, /* 1=processor speed can be switched dynamically */
- hasSCSIDiskMode = 6, /* 1=SCSI Disk Mode is supported */
- canGetBatteryTime = 7, /* 1=battery time can be calculated */
- canWakeupOnRing = 8, /* 1=can wakeup when the modem detects a ring */
- hasDimmingSupport = 9, /* 1=has dimming support built in */
- hasStartupTimer = 10, /* 1=startup timer is supported */
- hasDimLCDDownSupport = 11, /* 1=supports dimming LCD to off even on dimMinAt1s */
- hasChargeNotification = 11 /* 1=client can determine of charge connect status change notifications available */
- };
-
- /* bits in bitfield returned by GetIntModemInfo and set by SetIntModemState */
-
- enum {
- hasInternalModem = 0, /* 1=internal modem installed */
- intModemRingDetect = 1, /* 1=internal modem has detected a ring */
- intModemOffHook = 2, /* 1=internal modem is off hook */
- intModemRingWakeEnb = 3, /* 1=wakeup on ring is enabled */
- extModemSelected = 4, /* 1=external modem selected */
- modemSetBit = 15 /* 1=set bit, 0=clear bit (SetIntModemState) */
- };
-
- /* bits in BatteryInfo.flags */
- /* ("chargerConnected" doesn't mean the charger is plugged in) */
-
- enum {
- batteryInstalled = 7, /* 1=battery is currently connected */
- batteryCharging = 6, /* 1=battery is being charged */
- chargerConnected = 5 /* 1=charger is connected to the PowerBook */
- };
-
-
- enum {
- HDPwrQType = 0x4844, /* 'HD' hard disk spindown queue element type */
- PMgrStateQType = 0x504D /* 'PM' Power Manager state queue element type */
- };
-
- /* client notification bits in PMgrQueueElement.pmNotifyBits */
-
- enum {
- pmSleepTimeoutChanged = 0,
- pmSleepEnableChanged = 1,
- pmHardDiskTimeoutChanged = 2,
- pmHardDiskSpindownChanged = 3,
- pmDimmingTimeoutChanged = 4,
- pmDimmingEnableChanged = 5,
- pmDiskModeAddressChanged = 6,
- pmProcessorCyclingChanged = 7,
- pmProcessorSpeedChanged = 8,
- pmWakeupTimerChanged = 9,
- pmStartupTimerChanged = 10,
- pmHardDiskPowerRemovedbyUser = 11,
- pmChargeStatusChanged = 12
- };
-
- /* System Activity Selectors */
-
- enum {
- OverallAct = 0, /* general type of activity */
- UsrActivity = 1, /* user specific type of activity */
- NetActivity = 2, /* network specific activity */
- HDActivity = 3 /* Hard Drive activity */
- };
-
- /* Storage Media sleep mode defines */
-
- enum {
- kMediaModeOn = 0, /* Media active (Drive spinning and at full power) */
- kMediaModeStandBy = 1, /* Media standby (not implemented) */
- kMediaModeSuspend = 2, /* Media Idle (not implemented) */
- kMediaModeOff = 3 /* Media Sleep (Drive not spinning and at min power, max recovery time) */
- };
-
-
- enum {
- kMediaPowerCSCode = 70
- };
-
- /* definitions for HDQueueElement.hdFlags */
-
- enum {
- kHDQueuePostBit = 0, /* 1 = call this routine on the second pass */
- kHDQueuePostMask = (1 << kHDQueuePostBit)
- };
-
- struct ActivityInfo {
- short ActivityType; /* Type of activity to be fetched. Same as UpdateSystemActivity Selectors */
- unsigned long ActivityTime; /* Time of last activity (in ticks) of specified type. */
- };
- typedef struct ActivityInfo ActivityInfo;
-
- /* information returned by GetScaledBatteryInfo */
- struct BatteryInfo {
- UInt8 flags; /* misc flags (see below) */
- UInt8 warningLevel; /* scaled warning level (0-255) */
- UInt8 reserved; /* reserved for internal use */
- UInt8 batteryLevel; /* scaled battery level (0-255) */
- };
- typedef struct BatteryInfo BatteryInfo;
-
- typedef SInt8 ModemByte;
- typedef SInt8 BatteryByte;
- typedef SInt8 SoundMixerByte;
- typedef long PMResultCode;
- typedef struct SleepQRec SleepQRec;
- typedef SleepQRec *SleepQRecPtr;
- typedef struct HDQueueElement HDQueueElement;
- typedef struct PMgrQueueElement PMgrQueueElement;
- /*
- This ProcPtr uses register based parameters on the 68k and cannot
- be written in or called from a high-level language without the help of
- mixed mode or assembly glue.
-
- typedef pascal long (*SleepQProcPtr)(long message, SleepQRecPtr qRecPtr);
-
- */
- typedef pascal void (*HDSpindownProcPtr)(HDQueueElement *theElement);
- typedef pascal void (*PMgrStateChangeProcPtr)(PMgrQueueElement *theElement, long stateBits);
-
- #if GENERATINGCFM
- typedef UniversalProcPtr SleepQUPP;
- typedef UniversalProcPtr HDSpindownUPP;
- typedef UniversalProcPtr PMgrStateChangeUPP;
- #else
- typedef Register68kProcPtr SleepQUPP;
- typedef HDSpindownProcPtr HDSpindownUPP;
- typedef PMgrStateChangeProcPtr PMgrStateChangeUPP;
- #endif
- struct SleepQRec {
- SleepQRecPtr sleepQLink; /* pointer to next queue element */
- short sleepQType; /* queue element type (must be SleepQType) */
- SleepQUPP sleepQProc; /* pointer to sleep universal proc ptr */
- short sleepQFlags; /* flags */
- };
-
- struct HDQueueElement {
- struct HDQueueElement * hdQLink; /* pointer to next queue element */
- short hdQType; /* queue element type (must be HDPwrQType) */
- short hdFlags; /* miscellaneous flags */
- HDSpindownUPP hdProc; /* pointer to routine to call */
- long hdUser; /* user-defined (variable storage, etc.) */
- };
-
- struct PMgrQueueElement {
- struct PMgrQueueElement * pmQLink; /* pointer to next queue element */
- short pmQType; /* queue element type (must be PMgrStateQType) */
- short pmFlags; /* miscellaneous flags */
- long pmNotifyBits; /* bitmap of which changes to be notified for */
- PMgrStateChangeUPP pmProc; /* pointer to routine to call */
- long pmUser; /* user-defined (variable storage, etc.) */
- };
-
- struct BatteryTimeRec {
- unsigned long expectedBatteryTime; /* estimated battery time remaining (seconds) */
- unsigned long minimumBatteryTime; /* minimum battery time remaining (seconds) */
- unsigned long maximumBatteryTime; /* maximum battery time remaining (seconds) */
- unsigned long timeUntilCharged; /* time until battery is fully charged (seconds)*/
- };
- typedef struct BatteryTimeRec BatteryTimeRec;
-
- struct WakeupTime {
- unsigned long wakeTime; /* wakeup time (same format as current time) */
- Boolean wakeEnabled; /* 1=enable wakeup timer, 0=disable wakeup timer */
- SInt8 filler;
- };
- typedef struct WakeupTime WakeupTime;
-
- struct StartupTime {
- unsigned long startTime; /* startup time (same format as current time) */
- Boolean startEnabled; /* 1=enable startup timer, 0=disable startup timer */
- SInt8 filler;
- };
- typedef struct StartupTime StartupTime;
-
- extern pascal OSErr DisableWUTime(void );
-
- extern pascal OSErr SetWUTime(long WUTime);
-
- extern pascal OSErr GetWUTime(long *WUTime, Byte *WUFlag);
-
- extern pascal OSErr BatteryStatus(Byte *Status, Byte *Power);
-
- extern pascal OSErr ModemStatus(Byte *Status);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 IdleUpdate
- #endif
- extern pascal long IdleUpdate(void )
- ONEWORDINLINE(0xA285);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetCPUSpeed
- #endif
- extern pascal long GetCPUSpeed(void )
- TWOWORDINLINE(0x70FF, 0xA485);
-
- extern pascal void EnableIdle(void )
- TWOWORDINLINE(0x7000, 0xA485);
-
- extern pascal void DisableIdle(void )
- TWOWORDINLINE(0x7001, 0xA485);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SleepQInstall(__A0)
- #endif
- extern pascal void SleepQInstall(SleepQRecPtr qRecPtr)
- ONEWORDINLINE(0xA28A);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SleepQRemove(__A0)
- #endif
- extern pascal void SleepQRemove(SleepQRecPtr qRecPtr)
- ONEWORDINLINE(0xA48A);
-
- extern pascal void AOn(void )
- TWOWORDINLINE(0x7004, 0xA685);
-
- extern pascal void AOnIgnoreModem(void )
- TWOWORDINLINE(0x7005, 0xA685);
-
- extern pascal void BOn(void )
- TWOWORDINLINE(0x7000, 0xA685);
-
- extern pascal void AOff(void )
- TWOWORDINLINE(0x7084, 0xA685);
-
- extern pascal void BOff(void )
- TWOWORDINLINE(0x7080, 0xA685);
-
- /* Public Power Management API (NEW!) */
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 PMSelectorCount
- #endif
- extern pascal short PMSelectorCount(void )
- TWOWORDINLINE(0x7000, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 PMFeatures
- #endif
- extern pascal unsigned long PMFeatures(void )
- TWOWORDINLINE(0x7001, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetSleepTimeout
- #endif
- extern pascal UInt8 GetSleepTimeout(void )
- TWOWORDINLINE(0x7002, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetSleepTimeout(__D0)
- #endif
- extern pascal void SetSleepTimeout(UInt8 timeout)
- FOURWORDINLINE(0x4840, 0x303C, 0x0003, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetHardDiskTimeout
- #endif
- extern pascal UInt8 GetHardDiskTimeout(void )
- TWOWORDINLINE(0x7004, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetHardDiskTimeout(__D0)
- #endif
- extern pascal void SetHardDiskTimeout(UInt8 timeout)
- FOURWORDINLINE(0x4840, 0x303C, 0x0005, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 HardDiskPowered
- #endif
- extern pascal Boolean HardDiskPowered(void )
- TWOWORDINLINE(0x7006, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SpinDownHardDisk
- #endif
- extern pascal void SpinDownHardDisk(void )
- TWOWORDINLINE(0x7007, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 IsSpindownDisabled
- #endif
- extern pascal Boolean IsSpindownDisabled(void )
- TWOWORDINLINE(0x7008, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetSpindownDisable(__D0)
- #endif
- extern pascal void SetSpindownDisable(Boolean setDisable)
- FOURWORDINLINE(0x4840, 0x303C, 0x0009, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 HardDiskQInstall(__A0)
- #endif
- extern pascal OSErr HardDiskQInstall(HDQueueElement *theElement)
- TWOWORDINLINE(0x700A, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 HardDiskQRemove(__A0)
- #endif
- extern pascal OSErr HardDiskQRemove(HDQueueElement *theElement)
- TWOWORDINLINE(0x700B, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter GetScaledBatteryInfo(__D0, __A0)
- #endif
- extern pascal void GetScaledBatteryInfo(short whichBattery, BatteryInfo *theInfo)
- FIVEWORDINLINE(0x4840, 0x303C, 0x000C, 0xA09E, 0x2080);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter AutoSleepControl(__D0)
- #endif
- extern pascal void AutoSleepControl(Boolean enableSleep)
- FOURWORDINLINE(0x4840, 0x303C, 0x000D, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetIntModemInfo
- #endif
- extern pascal unsigned long GetIntModemInfo(void )
- TWOWORDINLINE(0x700E, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetIntModemState(__D0)
- #endif
- extern pascal void SetIntModemState(short theState)
- FOURWORDINLINE(0x4840, 0x303C, 0x000F, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 MaximumProcessorSpeed
- #endif
- extern pascal short MaximumProcessorSpeed(void )
- TWOWORDINLINE(0x7010, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 CurrentProcessorSpeed
- #endif
- extern pascal short CurrentProcessorSpeed(void )
- TWOWORDINLINE(0x7011, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 FullProcessorSpeed
- #endif
- extern pascal Boolean FullProcessorSpeed(void )
- TWOWORDINLINE(0x7012, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 SetProcessorSpeed(__D0)
- #endif
- extern pascal Boolean SetProcessorSpeed(Boolean fullSpeed)
- FOURWORDINLINE(0x4840, 0x303C, 0x0013, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetSCSIDiskModeAddress
- #endif
- extern pascal short GetSCSIDiskModeAddress(void )
- TWOWORDINLINE(0x7014, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetSCSIDiskModeAddress(__D0)
- #endif
- extern pascal void SetSCSIDiskModeAddress(short scsiAddress)
- FOURWORDINLINE(0x4840, 0x303C, 0x0015, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter GetWakeupTimer(__A0)
- #endif
- extern pascal void GetWakeupTimer(WakeupTime *theTime)
- TWOWORDINLINE(0x7016, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetWakeupTimer(__A0)
- #endif
- extern pascal void SetWakeupTimer(WakeupTime *theTime)
- TWOWORDINLINE(0x7017, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 IsProcessorCyclingEnabled
- #endif
- extern pascal Boolean IsProcessorCyclingEnabled(void )
- TWOWORDINLINE(0x7018, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter EnableProcessorCycling(__D0)
- #endif
- extern pascal void EnableProcessorCycling(Boolean enable)
- FOURWORDINLINE(0x4840, 0x303C, 0x0019, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 BatteryCount
- #endif
- extern pascal short BatteryCount(void )
- TWOWORDINLINE(0x701A, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetBatteryVoltage(__D0)
- #endif
- extern pascal Fixed GetBatteryVoltage(short whichBattery)
- FOURWORDINLINE(0x4840, 0x303C, 0x001B, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter GetBatteryTimes(__D0, __A0)
- #endif
- extern pascal void GetBatteryTimes(short whichBattery, BatteryTimeRec *theTimes)
- FOURWORDINLINE(0x4840, 0x303C, 0x001C, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetDimmingTimeout
- #endif
- extern pascal UInt8 GetDimmingTimeout(void )
- TWOWORDINLINE(0x701D, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetDimmingTimeout(__D0)
- #endif
- extern pascal void SetDimmingTimeout(UInt8 timeout)
- FOURWORDINLINE(0x4840, 0x303C, 0x001E, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter DimmingControl(__D0)
- #endif
- extern pascal void DimmingControl(Boolean enableSleep)
- FOURWORDINLINE(0x4840, 0x303C, 0x001F, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 IsDimmingControlDisabled
- #endif
- extern pascal Boolean IsDimmingControlDisabled(void )
- TWOWORDINLINE(0x7020, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 IsAutoSlpControlDisabled
- #endif
- extern pascal Boolean IsAutoSlpControlDisabled(void )
- TWOWORDINLINE(0x7021, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 PMgrStateQInstall(__A0)
- #endif
- extern pascal OSErr PMgrStateQInstall(PMgrQueueElement *theElement)
- TWOWORDINLINE(0x7022, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 PMgrStateQRemove(__A0)
- #endif
- extern pascal OSErr PMgrStateQRemove(PMgrQueueElement *theElement)
- TWOWORDINLINE(0x7023, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 UpdateSystemActivity(__D0)
- #endif
- extern pascal OSErr UpdateSystemActivity(UInt8 activity)
- FOURWORDINLINE(0x4840, 0x303C, 0x0024, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 DelaySystemIdle
- #endif
- extern pascal OSErr DelaySystemIdle(void )
- TWOWORDINLINE(0x7025, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetStartupTimer(__A0)
- #endif
- extern pascal OSErr GetStartupTimer(StartupTime *theTime)
- TWOWORDINLINE(0x7026, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 SetStartupTimer(__A0)
- #endif
- extern pascal OSErr SetStartupTimer(StartupTime *theTime)
- TWOWORDINLINE(0x7027, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetLastActivity(__A0)
- #endif
- extern pascal OSErr GetLastActivity(ActivityInfo *theActivity)
- TWOWORDINLINE(0x7028, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetSoundMixerState(__A0)
- #endif
- extern pascal OSErr GetSoundMixerState(SoundMixerByte *theSoundMixerByte)
- TWOWORDINLINE(0x7029, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 SetSoundMixerState(__A0)
- #endif
- extern pascal OSErr SetSoundMixerState(SoundMixerByte *theSoundMixerByte)
- TWOWORDINLINE(0x702A, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 GetDimLCDDownState
- #endif
- extern pascal Boolean GetDimLCDDownState(void )
- TWOWORDINLINE(0x702B, 0xA09E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter SetDimLCDDownState(__D0)
- #endif
- extern pascal void SetDimLCDDownState(Boolean dimLCDDownState)
- FOURWORDINLINE(0x4840, 0x303C, 0x002C, 0xA09E);
-
-
- enum {
- uppSleepQProcInfo = kRegisterBased
- | RESULT_SIZE(SIZE_CODE(sizeof(long)))
- | REGISTER_RESULT_LOCATION(kRegisterD0)
- | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(long)))
- | REGISTER_ROUTINE_PARAMETER(2, kRegisterA0, SIZE_CODE(sizeof(SleepQRecPtr))),
- uppHDSpindownProcInfo = kPascalStackBased
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(HDQueueElement *))),
- uppPMgrStateChangeProcInfo = kPascalStackBased
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(PMgrQueueElement *)))
- | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
- };
-
- #if GENERATINGCFM
- #define NewSleepQProc(userRoutine) \
- (SleepQUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentArchitecture())
- #define NewHDSpindownProc(userRoutine) \
- (HDSpindownUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture())
- #define NewPMgrStateChangeProc(userRoutine) \
- (PMgrStateChangeUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, GetCurrentArchitecture())
- #else
- #define NewSleepQProc(userRoutine) \
- ((SleepQUPP) (userRoutine))
- #define NewHDSpindownProc(userRoutine) \
- ((HDSpindownUPP) (userRoutine))
- #define NewPMgrStateChangeProc(userRoutine) \
- ((PMgrStateChangeUPP) (userRoutine))
- #endif
-
- #if GENERATINGCFM
- #define CallSleepQProc(userRoutine, message, qRecPtr) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), uppSleepQProcInfo, (message), (qRecPtr))
- #define CallHDSpindownProc(userRoutine, theElement) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), uppHDSpindownProcInfo, (theElement))
- #define CallPMgrStateChangeProc(userRoutine, theElement, stateBits) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, (theElement), (stateBits))
- #else
- /* (*SleepQUPP) cannot be called from a high-level language without the Mixed Mode Manager */
- #define CallHDSpindownProc(userRoutine, theElement) \
- (*(userRoutine))((theElement))
- #define CallPMgrStateChangeProc(userRoutine, theElement, stateBits) \
- (*(userRoutine))((theElement), (stateBits))
- #endif
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __POWER__ */
-
-